import request from '@/util/request'
import store from '@/vuex/store'
import config from "@/config/config";

// 查询新闻数据
export function queryAllListApi(list) {
    const value = {
        pageSize: list.pageSize,
        currentPage: list.currentPage,
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'query/queryAllList.do',
        method: 'post',
        data: value
    })
}



export function queryHistoryListApi(list) {
    const value = {
        pageSize: list.pageSize,
        currentPage: list.currentPage,
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'history/query.do',
        method: 'post',
        data: value
    })
}

export function queryLawFileApi(applyCode) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: applyCode
    }
    return request({
        url: 'document/getLawFile.do',
        method: 'post',
        data: value
    })
}

//导出mdb
export function exportMdbApi(exportMdbVo) {
    var params = new URLSearchParams();
    params.append('appKey', '');
    params.append('appFlag', 1);
    params.append('versionCode', 1);
    params.append('param', JSON.stringify(exportMdbVo));
    params.append("token", store.getters.token);
    window.location.href = (config.baseUrl + "/mdb/exportMdb.do?params=" + params);
}

//导出mdb
export function exportShapeApi(shape) {
    var params = new URLSearchParams();
    params.append('appKey', '');
    params.append('appFlag', 1);
    params.append('versionCode', 1);
    params.append('param', JSON.stringify(shape));
    params.append("token", store.getters.token);
    window.location.href = (config.baseUrl + "shape/exportShape?params=" + params);
}